package cn.felord.app.service.impl;

import cn.felord.app.entity.SysRole;
import cn.felord.app.mapper.SysRoleMapper;
import cn.felord.app.service.ISysRoleService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Set;

/**
 * <p>
 * 角色表 服务实现类
 * </p>
 *
 * @author system
 * @since 2019-04-16
 */
@Service
public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> implements ISysRoleService {
    @Resource
    private SysRoleMapper sysRoleMapper;

    @PreAuthorize("hasRole('Admin')")
    @Override
    public Set<String> queryRolesByUserId(String userId) {
        return sysRoleMapper.queryRolesByUserId(userId);
    }
}
